/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.insurance.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

/**
* @website https://el-admin.vip
* @description /
* @author HeHui
* @date 2022-01-03
**/
@Entity
@Data
@Table(name="i_insured_apply")
public class InsuredApply implements Serializable {

    private static final long serialVersionUID = 8597165688166851273L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "create_user_id")
    @ApiModelProperty(value = "创建人 用户申请为0 后台创建为操作人ID")
    private Long createUserId;

    @Column(name = "is_deleted")
    @ApiModelProperty(value = "是否删除")
    private Integer isDeleted;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建日期")
    private Timestamp createTime;

    @Column(name = "last_update_time")
    @ApiModelProperty(value = "最后更改时间")
    private Timestamp lastUpdateTime;

    @Column(name = "last_update_id")
    @ApiModelProperty(value = "最后修改人 后台用户ID")
    private Long lastUpdateId;

    @Column(name = "insured_user_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "案件申请人ID")
    private Long insuredUserId;

    @Column(name = "company_id")
    @ApiModelProperty(value = "案件所属公司ID")
    private Long companyId;

    @Column(name = "company_site_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "案件所属公司站点ID")
    private Long companySiteId;

    @Column(name = "site_user_name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "站长姓名")
    private String siteUserName;

    @Column(name = "site_user_mobile",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "站长手机")
    private String siteUserMobile;

    @Column(name = "report_no")
    @ApiModelProperty(value = "报案号")
    private String reportNo;

    @Column(name = "policy_no")
    @ApiModelProperty(value = "保单号")
    private String policyNo;

    @Column(name = "user_name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "骑手名称")
    private String userName;

    @Column(name = "user_mobile",nullable = false)
    @NotNull
    @ApiModelProperty(value = "出险人手机号码")
    private String userMobile;

    @Column(name = "user_id_card",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "骑手身份证")
    private String userIdCard;

    @Column(name = "claim_type",nullable = false)
    @NotNull
    @ApiModelProperty(value = "理赔对象，1骑手,2公司,3三者")
    private Integer claimType;

    @Column(name = "responsibility_ids",nullable = false)
    @NotNull
    @ApiModelProperty(value = "责任判断ids")
    private String responsibilityIds;

    @Column(name = "additional",nullable = false)
    @NotNull
    @ApiModelProperty(value = "有无附加险")
    private Integer additional;

    @Column(name = "case_speek")
    @ApiModelProperty(value = "案件进度")
    private Integer caseSpeek;

    @Column(name = "accident_date",nullable = false)
    @NotNull
    @ApiModelProperty(value = "事故发生时间")
    private Timestamp accidentDate;

    @Column(name = "accident_type_ids")
    @ApiModelProperty(value = "出险类型")
    private String accidentTypeIds;

    @Column(name = "accident_region_code")
    @ApiModelProperty(value = "事故区域code")
    private String accidentRegionCode;

    @Column(name = "accident_address")
    @ApiModelProperty(value = "事故地址")
    private String accidentAddress;

    @Column(name = "accident_desc")
    @ApiModelProperty(value = "事故说明")
    private String accidentDesc;

    @Column(name = "responsible_user_id")
    @ApiModelProperty(value = "理赔员ID，后台用户ID")
    private Long responsibleUserId;

    @Column(name = "case_status",nullable = false)
    @NotNull
    @ApiModelProperty(value = "案件状态")
    private Integer caseStatus;

    @Column(name = "main_insured_compensation_amount")
    @ApiModelProperty(value = "主险赔付金额")
    private BigDecimal mainInsuredCompensationAmount;

    @Column(name = "additional_main_insured_compensation_amount")
    @ApiModelProperty(value = "附加险赔付金额")
    private BigDecimal additionalMainInsuredCompensationAmount;

    @Column(name = "other_amount")
    @ApiModelProperty(value = "其他金额")
    private BigDecimal otherAmount;

    @Column(name = "next_connect_time")
    @ApiModelProperty("下次沟通时间")
    private Timestamp nextConnectTime;

    @Column(name = "main_scheme")
    private Long mainScheme;

    @Column(name = "additional_scheme")
    private Long additionalScheme;

    /**
     * 结案时间
     */
    @Column(name = "over_time")
    private Timestamp overTime;

    public void copy(InsuredApply source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}